package com.ccc.dao.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.ccc.dao.ProductDao;
import com.ccc.model.Product;
import com.ccc.util.dao.UtilDao;

@Component("productDao")
public class ProductDaoImpl implements ProductDao {
	private UtilDao utilDao;

	@Override
	public void addProduct(Product product) {
		utilDao.save(product);
	}

	@Override
	public void deleteProduct(Product product) {
		utilDao.delete(product);
	}

	@Override
	public void updateProduct(Product product) {
		utilDao.update(product);
	}

	@Override
	public Product findProduct(int id) {
		return utilDao.find(Product.class, id);
	}

	public UtilDao getUtilDao() {
		return utilDao;
	}

	@Resource
	public void setUtilDao(UtilDao utilDao) {
		this.utilDao = utilDao;
	}

	@Override
	public List<Product> findProduct(String hql,Object[] o) {
		return utilDao.find(hql, o);
	}

}
